import 'package:app/shared/shared.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class SplashController extends GetxController {
  @override
  Future<void> onReady() async {
    super.onReady();

    await Future.delayed(Duration(seconds: 3));
    var storage = Get.find<SharedPreferences>();

    print(storage.getString(StorageConstants.assess_token));
    try {
      if (storage.getString(StorageConstants.assess_token) != null) {
        Get.offNamed("/home");
      } else {
        Get.offNamed("/introduce");
      }
    } catch (e) {
      Get.offNamed("/introduce");
    }
  }
}
